package com.appistry.storage.exception;

import com.appistry.api.rest.domain.RestResponse;

public class StorageManagerRestException extends StorageManagerException{
	private static final long serialVersionUID = -8135545775676481672L;
	private String restResponseStr;
	private int statusCode;

	public StorageManagerRestException(RestResponse restResponse, String message, Throwable cause) {
		super(message, cause);
		this.restResponseStr = restResponse.toString();
		this.statusCode = restResponse.getStatusCode();
	}

	public StorageManagerRestException(RestResponse restResponse, String message) {
		super(message);
		this.restResponseStr = restResponse.toString();
		this.statusCode = restResponse.getStatusCode();
	}

	public StorageManagerRestException(RestResponse restResponse, Throwable cause) {
		super(cause);
		this.restResponseStr = restResponse.toString();
		this.statusCode = restResponse.getStatusCode();
	}

	public StorageManagerRestException(RestResponse restResponse) {
		super();
		this.restResponseStr = restResponse.toString();
		this.statusCode = restResponse.getStatusCode();
	}

	public String getRestResponse() {
		return restResponseStr;
	}
	
	public int getStatusCode(){
		return statusCode;
	}
	
	@Override
	public String getMessage(){
		return super.getMessage() + " -- " + restResponseStr;
	}
}
